package com.chatplus.application.domain.entity.account;

import com.baomidou.mybatisplus.annotation.*;
import com.chatplus.application.common.enumeration.UserStatusEnum;
import com.chatplus.application.datasource.annotation.JsonCollectionGenericType;
import com.chatplus.application.datasource.handler.JacksonJsonTypeHandler;
import com.chatplus.application.datasource.id.IdEntity;
import com.chatplus.application.domain.dto.UserCustomChatConfigDto;
import org.apache.ibatis.type.Alias;
import java.time.Instant;
import java.util.List;

/**
 * <p>Table: t_user - 用户表</p>
 *
 * @author developer
 */
@Alias("user")
@TableName(value = "t_user", autoResultMap = true)
public class UserEntity extends IdEntity {

    /**
     * 昵称
     */
    private String nickname;
    /**
     * 登录账号
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 头像
     */
    private String avatar;
    /**
     * 累计消耗 tokens
     */
    private Long totalTokens;
    /**
     * 当月消耗 tokens
     */
    private Long tokens;
    /**
     * 剩余调用次数
     */
    private Long calls;
    /**
     * 剩余绘图次数
     */
    private Long imgCalls;
    /**
     * 用户过期时间
     */
    private Instant expiredTime;
    /**
     * 当前状态
     */
    private UserStatusEnum status;
    /**
     * 聊天配置json
     */
    @TableField(typeHandler = JacksonJsonTypeHandler.class)
    private UserCustomChatConfigDto chatConfig;
    /**
     * 聊天角色 json
     */
    @JsonCollectionGenericType(String.class)
    @TableField(typeHandler = JacksonJsonTypeHandler.class)
    private List<String> chatRoles;
    /**
     * AI模型 json
     */
    @JsonCollectionGenericType(String.class)
    @TableField(typeHandler = JacksonJsonTypeHandler.class)
    private List<String> chatModels;
    /**
     * 最后登录时间
     */
    private Instant lastLoginAt;
    /**
     * 是否会员
     */
    private Boolean vip;
    /**
     * 最后登录 IP
     */
    private String lastLoginIp;
    /**
     * 是否是管理员
     */
    private Boolean admin;

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password =  password;
    }

    public String getAvatar() {
        return this.avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar =  avatar;
    }


    public Long getTotalTokens() {
        return this.totalTokens;
    }

    public void setTotalTokens(Long totalTokens) {
        this.totalTokens =  totalTokens;
    }

    public Long getTokens() {
        return this.tokens;
    }

    public void setTokens(Long tokens) {
        this.tokens =  tokens;
    }

    public Long getCalls() {
        return this.calls;
    }

    public void setCalls(Long calls) {
        this.calls =  calls;
    }

    public Long getImgCalls() {
        return this.imgCalls;
    }

    public void setImgCalls(Long imgCalls) {
        this.imgCalls =  imgCalls;
    }

    public Instant getExpiredTime() {
        return this.expiredTime;
    }

    public void setExpiredTime(Instant expiredTime) {
        this.expiredTime =  expiredTime;
    }

    public UserStatusEnum getStatus() {
        return this.status;
    }

    public void setStatus(UserStatusEnum status) {
        this.status =  status;
    }

    public UserCustomChatConfigDto getChatConfig() {
        return chatConfig;
    }

    public void setChatConfig(UserCustomChatConfigDto chatConfig) {
        this.chatConfig = chatConfig;
    }

    public List<String> getChatRoles() {
        return chatRoles;
    }

    public void setChatRoles(List<String> chatRoles) {
        this.chatRoles = chatRoles;
    }

    public List<String> getChatModels() {
        return chatModels;
    }

    public void setChatModels(List<String> chatModels) {
        this.chatModels = chatModels;
    }

    public Instant getLastLoginAt() {
        return this.lastLoginAt;
    }

    public void setLastLoginAt(Instant lastLoginAt) {
        this.lastLoginAt =  lastLoginAt;
    }

    public Boolean getVip() {
        return this.vip;
    }

    public void setVip(Boolean vip) {
        this.vip =  vip;
    }

    public String getLastLoginIp() {
        return this.lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp =  lastLoginIp;
    }

    public Boolean getAdmin() {
        return admin;
    }

    public void setAdmin(Boolean admin) {
        this.admin = admin;
    }
}
